/**
 * 
 */
package com.qolome.enums;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;

/**
 * @Description: 结果枚举集
 * @author 姜锋
 * @date 2019-02-06 13:52
 * @version V1.0   
 *
 */
@Getter
public enum ResultEnum implements IEnum{
	
	SUCCESS(200, "成功"),
	ERROR_UNKONW(999, "未分类错误"),
	BAD_REQUEST(400,"错误的请求"),
	ERROR_BEAN(501, "bean验证错误"),
	ERROR_USER_TOKEN(502, "拦截器拦截到用户token出错"),
	ERROR_BINDING_RESULT(503, "参数不匹配"),
	ERROR_OPERATE(504,"操作失败"),
	USER_NOT_FUND(404,"用户信息未找到"),
	ACCOUNT_NOT_FUND(405,"账户信息未找到"),
	ERROR_EXCEPTION(505,"操作出现异常");
	
	@ApiModelProperty(value = "状态码")
	private Integer code;
	@ApiModelProperty(value = "信息")
    private String message;

    ResultEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

	public static ResultEnum codeOf(int index) {
		for (ResultEnum result : values()) {
			if (result.getCode() == index) {
				return result;
			}
		}
		return null;
	}
}
